Pygrub: stop the FS identification code from leaking open fds.
authorTim Deegan <tim.deegan@xensource.com>
Thu, 21 Sep 2006 13:55:02 +0000 (14:55 +0100)
committerTim Deegan <tim.deegan@xensource.com>
Thu, 21 Sep 2006 13:55:02 +0000 (14:55 +0100)
Signed-off-by: Tim Deegan <tim.deegn@xensource.com>
tools/pygrub/src/fsys/ext2/__init__.py
tools/pygrub/src/fsys/reiser/__init__.py

index 4c3fe12c000a13600d855c305e1125ef9989f2c9..ebb5393bccd5229bf18de1435fa0628ffdb0eeae 100644 (file)
@@ -23,7 +23,7 @@ class Ext2FileSystemType(FileSystemType):
         fd = os.open(fn, os.O_RDONLY)
         os.lseek(fd, offset, 0)
         buf = os.read(fd, 2048)
-        
+        os.close(fd)        
         if len(buf) > 1082 and \
                struct.unpack("<H", buf[1080:1082]) == (0xef53,):
             return True
index e49e7c3e0a9f944027d2a3a0d1e7e130d5248f74..57551283c0f70ac8b484ddfe10640ac96ddfd2e3 100644 (file)
@@ -26,6 +26,7 @@ class ReiserFileSystemType(FileSystemType):
         fd = os.open(fn, os.O_RDONLY)
         os.lseek(fd, 0x10000, 0)
         buf = os.read(fd, 0x40)
+        os.close(fd)
         if len(buf) == 0x40 and (buf[0x34:0x3B] in [FSMAGIC2, FSMAGIC3]) :
             return True
         return False